<html>
<head><meta charset="utf-8"><title>Calling ParseCommandLineOptions twice · t-compiler/wg-llvm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/index.html">t-compiler/wg-llvm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Calling.20ParseCommandLineOptions.20twice.html">Calling ParseCommandLineOptions twice</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213808524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Calling%20ParseCommandLineOptions%20twice/near/213808524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Calling.20ParseCommandLineOptions.20twice.html#213808524">(Oct 19 2020 at 16:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/c71248b70870960af9993de4f31d3cba9bbce7e8/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L586"><code>LLVMRustSetLLVMOptions</code></a> says that calling <code>ParseCommandLineOptions</code> more than once is not allowed and as such it only initializes once, even when the arguments have since changed. This was introduced in <a href="https://github.com/rust-lang/rust/commit/d6f455ebca79b6a3d374158a047b1cdd744ebc5e">d6f455ebca79b6a3d374158a047b1cdd744ebc5e</a>. <code>ParseCommandLineOptions</code> doesn't seem to be documented as only callable. (<a href="https://www.llvm.org/docs/CommandLine.html#the-cl-parsecommandlineoptions-function">https://www.llvm.org/docs/CommandLine.html#the-cl-parsecommandlineoptions-function</a>) Is this still the case after 7 years?</p>



<a name="213808631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Calling%20ParseCommandLineOptions%20twice/near/213808631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Calling.20ParseCommandLineOptions.20twice.html#213808631">(Oct 19 2020 at 16:09)</a>:</h4>
<p>TIL about rustpkg used to exist.</p>



<a name="213816380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Calling%20ParseCommandLineOptions%20twice/near/213816380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Calling.20ParseCommandLineOptions.20twice.html#213816380">(Oct 19 2020 at 17:08)</a>:</h4>
<p>It seems that you need to call <a href="https://github.com/llvm/llvm-project/blob/225065b9a8e7ec0479b6ee8334f8fe4d4118f875/llvm/lib/Support/CommandLine.cpp#L2599"><code>cl::ResetCommandLineParser</code></a> first.</p>



<a name="213816754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Calling%20ParseCommandLineOptions%20twice/near/213816754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Calling.20ParseCommandLineOptions.20twice.html#213816754">(Oct 19 2020 at 17:12)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/rust/issues/78112">#78112</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>